package com.wh.beans.custom;

import com.legend.utils.StringUtils;
import com.wh.model.CustomField;

import java.text.MessageFormat;


public class LoginUser implements ICustomLabel {

	@Override
	public String getCustomLabel(CustomField field, LabelType type) {
		String label = "", template = "";
		String fieldLittleName = StringUtils.getFieldLittleCamel(field.getFieldDbName());
		String fieldBigName = StringUtils.getFieldBigCamel(field.getFieldDbName());
		StringBuffer s;
		switch (type) {
		case add:
			s = new StringBuffer();
			s.append(MessageFormat
					.format("<input type=\"hidden\" id=\"txt{0}\" name=\"{1}\"/><span>当前用户</span>",
							fieldBigName, fieldLittleName));
			label = s.toString();
			break;
		case edit:
			s = new StringBuffer();
			s.append(MessageFormat
					.format("<input type=\"hidden\" id=\"txt{0}\" name=\"{1}\"/><span>当前用户</span>",
							fieldBigName, fieldLittleName));
			label = s.toString();
			break;
		case view:
			template = "$'{'info.data.{0}'}'";
			label = MessageFormat.format(template, fieldLittleName);
			break;
		default:
			break;
		}
		return label;
	}

}
